{template 'common/header'}
<ul class="nav nav-tabs">
    <li {if $operation=='list' && $status=='' }class="active" {/if}>
        <a href="{php echo $this->createWebUrl('shopping', array('op' => 'order','operation' => 'list'))}">全部订单</a></li>
    <li {if $operation=='list' && $status=='1'} class="active" {/if}>
        <a href="{php echo $this->createWebUrl('shopping', array('op' => 'order','operation' => 'list', 'status' => 1))}">待发货</a></li>
    <li {if $operation=='list' && $status=='0' }class="active" {/if}>
        <a href="{php echo $this->createWebUrl('shopping', array('op' => 'order', 'operation' => 'list','status' => 0))}">待付款</a></li>
    <li {if $operation=='list' && $status=='2' }class="active" {/if}>
        <a href="{php echo $this->createWebUrl('shopping', array('op' => 'order', 'operation' => 'list','status' => 2))}">待收货</a></li>
    <li {if $operation=='list' && $status=='3' }class="active" {/if}>
        <a href="{php echo $this->createWebUrl('shopping', array('op' => 'order', 'operation' => 'list','status' => 3))}">已完成</a></li>
    <li {if $operation=='list' && $status=='-1' }class="active" {/if}>
        <a href="{php echo $this->createWebUrl('shopping', array('op' => 'order','operation' => 'list', 'status' => -1))}">已关闭</a></li>
    {if $operation == 'detail'}
    <li class="active"><a href="#">订单详情</a></li> {/if}
</ul>
<div class="main">
    <div class="panel panel-info">
        <div class="panel-heading">筛选</div>
        <div class="panel-body">
            <form action="" method="post" class="form-horizontal" role="form" id="form1">
                <div class="form-group">
                    <label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">订单号</label>
                    <div class="col-sm-8 col-lg-9 col-xs-12">
                        <input class="form-control" name="keyword" id="" type="text" value="{$_GPC['keyword']}" placeholder="可查询订单号">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-4 col-md-4 col-lg-2 control-label">用户信息</label>
                    <div class="col-sm-8 col-lg-9 col-xs-12">
                        <input class="form-control" name="member" id="" type="text" value="{$_GPC['member']}" placeholder="可查询手机号 / 姓名">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">支付方式</label>
                    <div class="col-sm-8 col-lg-9 col-xs-12">
                        <select name="paytype" class="form-control">
                            <option value="">不限</option>
                            {loop $paytype $key $type}
                            <option value="{$key}" {if $_GPC['paytype']==$key} selected="selected" {/if}>{$type['name']}</option>
                            {/loop}
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">下单时间</label>
                    <div class="col-sm-7 col-lg-9 col-xs-12">
                        {php echo tpl_form_field_daterange('time', array('starttime'=>date('Y-m-d', $starttime),'endtime'=>date('Y-m-d', $endtime)));}
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label"></label>
                    <div class="col-sm-7 col-lg-9 col-xs-12">
                        <button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>
                        <input type="hidden" name="token" value="{$_W['token']}" />
                        <button type="submit" name="export" value="1" class="btn btn-primary">导出 Excel</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
    <div class="panel panel-default">
        <div class="panel-body table-responsive">
            <table class="table table-hover">
                <thead class="navbar-inner">
                    <tr>
                        <th style="width:180px;">订单号</th>
                        <th style="width:80px;">收货姓名(或自提人)</th>
                        <th style="width:100px;">电话</th>
                        <th style="width:90px;">支付方式</th>
                        <th style="width:100px;">总价</th>
                        <th style="width:80px;">状态</th>
                        <th style="width:150px;">下单时间</th>
                        <th style="width:140px; text-align:right;">操作</th>
                    </tr>
                </thead>
                <tbody>
                    {loop $list $item}
                    <tr>
                        <td>{$item['ordersn']}</td>
                        <td>{$item['realname']}</td>
                        <td>{$item['mobile']}</td>
                        <td><span class="label label-{$item['css']}">{$item['paytype']}</span></td>
                        <td>{$item['price']} 元</td>
                        <td>
                            <span class="label label-{$item['statuscss']}">{$item['status']}</span></td>
                        <td>{php echo date('Y-m-d H:i:s', $item['createtime'])}</td>
                        <td style="text-align:right;">
                            <a href="{php echo $this->createWebUrl('shopping', array('op' => 'order','operation' => 'detail', 'id' => $item['id']))}" class="btn btn-success btn-sm">查看订单</a>
                            <a href="{php echo $this->createWebUrl('shopping', array('op' => 'order','id' => $item['id'], 'operation' => 'delete'))}" onclick="return confirm('此操作不可恢复，确认删除？');return false;" class="btn btn-default btn-sm" data-toggle="tooltip" data-placement="bottom" title="删除"><i class="fa fa-times">删除</i>
							</a>
                        </td>
                    </tr>
                    {/loop}
                </tbody>
                <!--tr>
					<td></td>
					<td colspan="3">
						<input name="token" type="hidden" value="{$_W['token']}" />
						<input type="submit" class="btn btn-primary" name="submit" value="提交" />
					</td>
				</tr-->
            </table>
        </div>
    </div>
</div>
{$pager}
<script type="text/javascript">
require(['daterangepicker'], function($) {
    $('.daterange').on('apply.daterangepicker', function(ev, picker) {
        $('#form1')[0].submit();
    });
});
</script>
{template 'common/footer'}
